#!/bin/bash

set -ex

#define vars
SHELL_PATH=$(dirname $0)
export MTSQL_PT_FEATURE_PATH=$(cd ${SHELL_PATH}/../; pwd)
export MTSQL_PT_FEATURE_PATH_THREAD_POOL=${MTSQL_PT_FEATURE_PATH}/threadpool

source ${MTSQL_PT_FEATURE_PATH}/env.sh
source ${MTSQL_PT_FEATURE_PATH_THREAD_POOL}/benchmark_base_func.sh

##oltp_read_write
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_read_write" ]]; then
#  MTSQL_PT_DB=sbtestRW32T12M
  MTSQL_PT_TEST_CASE=oltp_read_write
  mtsql_pt_sysbench_func_run
  sleep ${MTSQL_PT_TEST_INTERVAL_TIME}
fi

##oltp_read_only
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_read_only" ]]; then
#  MTSQL_PT_DB=sbtestRO32T12M
  MTSQL_PT_TEST_CASE=oltp_read_only
  mtsql_pt_sysbench_func_run
  sleep ${MTSQL_PT_TEST_INTERVAL_TIME}
fi

##oltp_update_non_index
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_update_non_index" ]]; then
#  MTSQL_PT_DB=sbtestUNI32T12M
  MTSQL_PT_TEST_CASE=oltp_update_non_index
  mtsql_pt_sysbench_func_run
  sleep ${MTSQL_PT_TEST_INTERVAL_TIME}
fi

##oltp_point_select
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_point_select" ]]; then
#  MTSQL_PT_DB=sbtestPS32T12M
  MTSQL_PT_TEST_CASE=oltp_point_select
  mtsql_pt_sysbench_func_run
fi

##oltp_write_only
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_write_only" ]]; then
#  MTSQL_PT_DB=sbtestWO32T12M
  MTSQL_PT_TEST_CASE=oltp_write_only
  mtsql_pt_sysbench_func_run
  sleep ${MTSQL_PT_TEST_INTERVAL_TIME}
fi

